package com.ryan.ohos.extension.scroll;

import com.ryan.ohos.extension.event.interfaces.ViewGroup;
import com.ryan.ohos.extension.nested.NestedScrollingHelper;
import ohos.agp.components.ComponentContainer;
import ohos.multimodalinput.event.TouchEvent;

/**
 * An interface that can be implemented by Views to provide scroll related APIs.
 */
public interface ScrollingView {
    /**
     * 获取父控件
     * @return 父控件
     */
    ComponentContainer getContainer();

    /**
     * 获取当前的Y轴滚动距离
     * @return Y轴滚动距离
     */
    int getScrollY();

    /**
     * 获取当前的X轴滚动距离
     * @return X轴滚动距离
     */
    int getScrollX();

    /**
     * 获取接受的滚动方向
     * @return 接受的滚动方向
     *
     * @see NestedScrollingHelper#SCROLL_AXIS_HORIZONTAL
     * @see NestedScrollingHelper#SCROLL_AXIS_VERTICAL
     * @see NestedScrollingHelper#SCROLL_AXIS_NONE
     */
    int getDirection();

    /**
     * 滚动
     * @param deltaX 该次滚动的x偏移量
     * @param deltaY 该次滚动的y偏移量
     */
    void scrollByInternal(int deltaX, int deltaY);

    /**
     * 滚动时是否要调用{@link ViewGroup#dispatchTouchEvent(TouchEvent)}
     */
    boolean disallowInterceptWhenMoving();
}
